-# $Id: app.pro,v 1.17 2010/06/03 15:01:24 robertl Exp $
+# $Id: app.pro,v 1.18 2010/06/19 23:59:06 robertl Exp $
#
CONFIG += qt release
QT += network \
xml \
- webkit
+ webkit \
unix:DESTDIR = objects
unix:MOC_DIR = objects
RESOURCES = app.qrc
RC_FILE = app.rc
-mac:TARGET=GPSBabelFE
win32:TARGET=GPSBabelFE
unix:TARGET=gpsbabelfe-bin
+mac:TARGET=GPSBabelFE
FORMS += aboutui.ui
FORMS += advui.ui
+FORMS += donate.ui
FORMS += filterui.ui
FORMS += gmapui.ui
FORMS += mainwinui.ui
FORMS += rttrkui.ui
FORMS += trackui.ui
FORMS += upgrade.ui
+FORMS += version_mismatch.ui
FORMS += wayptsui.ui
SOURCES += aboutdlg.cpp
SOURCES += advdlg.cpp
+SOURCES += donate.cpp
SOURCES += dpencode.cpp
SOURCES += filterdata.cpp
SOURCES += filterdlg.cpp
SOURCES += preferences.cpp
SOURCES += processwait.cpp
SOURCES += upgrade.cpp
+SOURCES += version_mismatch.cpp
macx:SOURCES += serial_mac.cpp
unix:SOURCES += serial_unix.cpp
windows:SOURCES += serial_win.cpp
HEADERS += advdlg.h
HEADERS += appname.h
HEADERS += babeldata.h
+HEADERS += donate.h
HEADERS += filterdata.h
HEADERS += filterdlg.h
HEADERS += filterwidgets.h
HEADERS += processwait.h
HEADERS += setting.h
HEADERS += upgrade.h
+HEADERS += version_mismatch.h
TRANSLATIONS += gpsbabelfe_ru.ts
TRANSLATIONS += gpsbabelfe_de.ts
// -*- C++ -*-
-// $Id: babeldata.h,v 1.7 2010/04/12 02:53:04 robertl Exp $
+// $Id: babeldata.h,v 1.8 2010/06/19 23:59:06 robertl Exp $
//------------------------------------------------------------------------
//
// Copyright (C) 2009 S. Khai Mong <khai@mangrai.com>.
upgradeCheckTime(QDateTime(QDate(2001, 1, 1), QTime(0, 0))),
installationUuid(QUuid::createUuid().toString()),
upgradeCallbacks(0),
+ upgradeAccept(0),
upgradeDeclines(0),
upgradeErrors(0),
upgradeOffers(0),
+ runCount(0),
startupVersionCheck(true),
reportStatistics(true),
- allowBetaUpgrades(false)
+ allowBetaUpgrades(false),
+ ignoreVersionMismatch(false),
+ disableDonateDialog(false),
+ donateSplashed(QDateTime(QDate(2010, 1, 1), QTime(0, 0, 0)))
{
};
sg.addVarSetting(new BoolSetting("app.previewGmap", previewGmap));
sg.addVarSetting(new IntSetting("app.upgradeCheckMethod", upgradeCheckMethod));
sg.addVarSetting(new DateTimeSetting("app.upgradeCheckTime", upgradeCheckTime));
+ sg.addVarSetting(new DateTimeSetting("app.donateSplashed", donateSplashed));
sg.addVarSetting(new StringSetting("app.installationUuid", installationUuid));
sg.addVarSetting(new IntSetting("app.upgradeCallbacks", upgradeCallbacks));
+ sg.addVarSetting(new IntSetting("app.upgradeAccept", upgradeAccept));
sg.addVarSetting(new IntSetting("app.upgradeDeclines", upgradeDeclines));
sg.addVarSetting(new IntSetting("app.upgradeErrors", upgradeErrors));
sg.addVarSetting(new IntSetting("app.upgradeOffers", upgradeOffers));
+ sg.addVarSetting(new IntSetting("app.runCount", runCount));
// Global preferences.
sg.addVarSetting(new BoolSetting("app.startupVersionCheck", startupVersionCheck));
sg.addVarSetting(new BoolSetting("app.reportStatistics", reportStatistics));
sg.addVarSetting(new BoolSetting("app.allowBetaUpgrades", allowBetaUpgrades));
+ sg.addVarSetting(new BoolSetting("app.ignoreVersionMismatch", ignoreVersionMismatch));
+ sg.addVarSetting(new BoolSetting("app.disableDonateDialog", disableDonateDialog));
}
QDateTime upgradeCheckTime;
QString installationUuid;
int upgradeCallbacks;
+ int upgradeAccept;
int upgradeDeclines;
int upgradeErrors;
int upgradeOffers;
+ int runCount;
// Global preferences.
bool startupVersionCheck;
bool reportStatistics;
bool allowBetaUpgrades;
+ bool ignoreVersionMismatch;
+ bool disableDonateDialog;
+ QDateTime donateSplashed;
};
--- /dev/null
+// -*- C++ -*-
+//------------------------------------------------------------------------
+//
+// Copyright (C) 2010 Robert Lipe <robertlipe@gpsbabel.org
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111
+// USA
+//
+
+#include "donate.h"
+#include <QUrl>
+#include <QDesktopServices>
+
+// A completely simple QDialog, in a class of its own for layout.
+Donate::Donate(QWidget *parent) : QDialog(parent)
+{
+ ui.setupUi(this);
+ connect(ui.contributeButton, SIGNAL(clicked()), this, SLOT(contributeClicked()));
+}
+
+void Donate::contributeClicked()
+{
+ QDesktopServices::openUrl(QUrl("http://www.gpsbabel.org/contribute.html"));
+ close();
+}
--- /dev/null
+// -*- C++ -*-
+//------------------------------------------------------------------------
+//
+// Copyright (C) 2010 Robert Lipe <robertlipe@gpsbabel.org>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111
+// USA
+//
+
+#ifndef DONATE_H
+#define DONATE_H
+
+#include "ui_donate.h"
+
+class Donate: public QDialog {
+ Q_OBJECT
+
+ public:
+ Donate(QWidget *parent);
+ void showNever(bool f) {
+ ui.neverAgain->setVisible(f);
+ ui.textLine2->setVisible(f);
+ }
+ bool neverAgain() { return ui.neverAgain->isChecked(); }
+
+ private:
+ Ui_Donate ui;
+
+ private slots:
+ void contributeClicked();
+
+};
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Donate</class>
+ <widget class="QDialog" name="Donate">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>351</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>400</width>
+ <height>300</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Support GPSBabel</string>
+ </property>
+ <widget class="QWidget" name="layoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>13</y>
+ <width>312</width>
+ <height>249</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="textLine1">
+ <property name="text">
+ <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">GPSBabel is free software built and supported by volunteers. It consumes vast amounts of time to create and support the software as well as money for mapping programs, GPS receivers, and development fixtures. Please see how you can <a href="http://www.gpsbabel.org"><span style=" text-decoration: underline; color:#0000ff;">contribute time or via PayPal (no account needed) or Google Checkout.</span></a></p></body></html></string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="textLine2">
+ <property name="text">
+ <string><p>Of course, if you've already contributed to the project or you just can't help the project, please check the box below to never see this message again.</p></string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="neverAgain">
+ <property name="text">
+ <string>Never show this message again.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="dismissButton">
+ <property name="text">
+ <string>No, Thanks</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="contributeButton">
+ <property name="text">
+ <string>Contribute</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>dismissButton</sender>
+ <signal>clicked()</signal>
+ <receiver>Donate</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>139</x>
+ <y>247</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>198</x>
+ <y>141</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
// -*- C++ -*-
-// $Id: mainwindow.cpp,v 1.20 2010/04/12 02:53:03 robertl Exp $
+// $Id: mainwindow.cpp,v 1.21 2010/06/19 23:59:06 robertl Exp $
//------------------------------------------------------------------------
//
// Copyright (C) 2009 S. Khai Mong <khai@mangrai.com>.
#include <QTextStream>
#include "mainwindow.h"
+#include "../gbversion.h"
#include "aboutdlg.h"
#include "advdlg.h"
#include "appname.h"
#include "babeldata.h"
+#include "donate.h"
#include "filterdlg.h"
#include "formatload.h"
#include "gmapdlg.h"
#include "optionsdlg.h"
#include "preferences.h"
#include "processwait.h"
+#include "version_mismatch.h"
#include "upgrade.h"
-#include "../gbversion.h"
const int BabelData::noType = -1;
const int BabelData::fileType = 0;
upgrade->checkForUpgrade(babelVersion, bd.upgradeCheckTime,
allowBetaUpgrades());
}
+
+ if (!bd.ignoreVersionMismatch && babelVersion != VERSION) {
+ VersionMismatch vm(0, babelVersion, QString(appName) + QString(" " VERSION));
+
+ vm.exec();
+ bd.ignoreVersionMismatch = vm.neverAgain();
+ }
}
//------------------------------------------------------------------------
if (wt.isValid()) {
bd.upgradeCheckTime = wt;
}
+ bd.runCount++;
+
+ QDateTime now = QDateTime::currentDateTime();
+ if((bd.runCount > 5) && (bd.donateSplashed.daysTo(now) > 30)) {
+ Donate donate(0);
+ if (bd.donateSplashed.date() == QDate(2010,1,1))
+ donate.showNever(false);
+ donate.exec();
+ bd.donateSplashed = now;
+ }
saveSettings();
delete upgrade;
upgrade = 0;
ui_.startupCheck->setChecked(bd_.startupVersionCheck);
ui_.reportStatisticsCheck->setChecked(bd_.reportStatistics);
+ ui_.ignoreVersionMismatchCheck->setChecked(bd_.ignoreVersionMismatch);
connect (ui_.buttonBox, SIGNAL(accepted()), this, SLOT(acceptClicked()));
connect (ui_.buttonBox, SIGNAL(rejected()), this, SLOT(rejectClicked()));
bd_.startupVersionCheck = ui_.startupCheck->isChecked();
bd_.reportStatistics = ui_.reportStatisticsCheck->isChecked();
+ bd_.ignoreVersionMismatch = ui_.ignoreVersionMismatchCheck->isChecked();
accept();
}
<rect>
<x>0</x>
<y>0</y>
- <width>504</width>
- <height>328</height>
+ <width>454</width>
+ <height>327</height>
</rect>
</property>
<property name="sizePolicy">
<rect>
<x>23</x>
<y>18</y>
- <width>234</width>
- <height>43</height>
+ <width>387</width>
+ <height>62</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="ignoreVersionMismatchCheck">
+ <property name="text">
+ <string>Ignore mismatch between command line and GUI version.</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</widget>
</widget>
// -*- C++ -*-
-// $Id: upgrade.cpp,v 1.25 2010/04/12 02:53:04 robertl Exp $
+// $Id: upgrade.cpp,v 1.26 2010/06/19 23:59:06 robertl Exp $
/*
Copyright (C) 2009, 2010 Robert Lipe, robertlipe@gpsbabel.org
args += "&last_checkin=" + lastCheckTime.toString(Qt::ISODate);
args += QString("&ugcb=%1").arg(bd_.upgradeCallbacks);
args += QString("&ugdec=%1").arg(bd_.upgradeDeclines);
+ args += QString("&ugacc=%1").arg(bd_.upgradeAccept);
args += QString("&ugoff=%1").arg(bd_.upgradeOffers);
args += QString("&ugerr=%1").arg(bd_.upgradeErrors);
+ args += QString("&rc=%1").arg(bd_.runCount);
int j = 0;
void UpgradeCheck::httpRequestFinished(int requestId, bool error)
{
- bd_.upgradeCallbacks++;
if (http == 0 || error) {
bd_.upgradeErrors++;
return;
}
+ bd_.upgradeCallbacks++;
QString oresponse(http->readAll());
QDomDocument document;
information.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
information.setDefaultButton(QMessageBox::Yes);
-
information.setText(response);
+
information.setInformativeText(tr("Do you wish to download an upgrade?"));
information.setDetailedText(upgradeText);
case QMessageBox::Yes:
// downloadUrl.addQueryItem("os", getOsName());
QDesktopServices::openUrl(downloadUrl);
+ bd_.upgradeAccept++;
+ break;
default: ;
bd_.upgradeDeclines++;
}
--- /dev/null
+// -*- C++ -*-
+//------------------------------------------------------------------------
+//
+// Copyright (C) 2010 Robert Lipe <robertlipe@gpsbabel.org
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111
+// USA
+//
+
+#include "version_mismatch.h"
+
+VersionMismatch::VersionMismatch(QWidget *parent, const QString &ver1,
+ const QString &ver2): QDialog(parent)
+{
+ ui.setupUi(this);
+
+ ui.ClVersion->setText(ver1);
+ ui.ClVersion->adjustSize();
+
+ ui.GuiVersion->setText(ver2);
+ ui.GuiVersion->adjustSize();
+}
--- /dev/null
+// -*- C++ -*-
+//------------------------------------------------------------------------
+//
+// Copyright (C) 2010 Robert Lipe <robertlipe@gpsbabel.org>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111
+// USA
+//
+
+#ifndef VERSION_MISMATCH_H
+#define VERSION_MISMATCH_H
+
+#include <QDialog>
+
+#include "ui_version_mismatch.h"
+
+class VersionMismatch: public QDialog {
+ public:
+ VersionMismatch(QWidget *parent, const QString &ver1,
+ const QString &ver2);
+ bool neverAgain() { return ui.neverAgain->isChecked(); }
+
+ private:
+ Ui_VersionMismatch ui;
+};
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>VersionMismatch</class>
+ <widget class="QDialog" name="VersionMismatch">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>346</width>
+ <height>144</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>400</width>
+ <height>300</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>GPSBabel Version Mismatch</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string><b>A version mismatch has been detected.</b></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>GPSBabel command line version:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="ClVersion">
+ <property name="toolTip">
+ <string notr="true" extracomment="Will be replaced by a versio nnumber at runtime. Do not translate."/>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>GPSBabel GUI version:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="GuiVersion">
+ <property name="toolTip">
+ <string extracomment="Will be replaced by a versio nnumber at runtime. Do not translate."/>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QCheckBox" name="neverAgain">
+ <property name="text">
+ <string>Never show this message again.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Ignore</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>VersionMismatch</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>VersionMismatch</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>